package com.stm.bi.report.demo;

import com.stm.bi.dto.vo.DemoStatisticsVO;
import com.stm.bi.model.DatatablePage;
import com.stm.bi.model.DatatableQuery;
import com.stm.bi.model.RowData;
import com.stm.bi.model.Title;
import com.stm.bi.report.AbsDatatableQueryExe;
import com.stm.framework.model.CustomizePage;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author chenyingjun
 * @Desc
 * @Date 2025/2/11 9:52
 */
@Component
public class DemoDatatableQueryExe extends AbsDatatableQueryExe<DatatableQuery, DatatablePage<DemoStatisticsVO>> {
    private static final String QUERY_TABLE_NAME = "ads_res_material_style_category_year";
    private static final String QUERY_SQL = "select * from "+QUERY_TABLE_NAME+" where org_no=? and year=?";

    @Override
    public DatatablePage<DemoStatisticsVO> query(Long orgId, String orgNo, DatatableQuery query) {
        DatatablePage page = queryPage(QUERY_SQL,new Object[]{orgNo,query.getStartDate()},query.getPageSize(),query.getPageNum());

        DemoStatisticsVO demoStatistics = new DemoStatisticsVO();
        demoStatistics.setCityCode("4401001");
        demoStatistics.setCityName("深圳");
        demoStatistics.setNewCustomProportion(new BigDecimal("0.01"));
        demoStatistics.setOldCustomProportion(new BigDecimal("0.02"));
        demoStatistics.setTotalCustomProportion(new BigDecimal("0.03"));
        page.setExtend(demoStatistics);
        return page;
    }

    @Override
    public String getReportName() {
        return "二维表查询-演示";
    }

    @Override
    public boolean syncExport(DatatablePage page) {
        return true;
    }
}
